from redis import StrictRedis


class config:
    DEBUG = None

    # python3
    # import os, base64
    # a = urandom(40)
    # base64.b64encode(a)
    # 生成密钥
    SECRET_KEY = 'P87hprI6fF1RbYnsz87gxZ/VpgP46CredikQjQV4u/HOsEd6QT+H+w=='

    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400

    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/ihome'
    SQLALCHEMY_TRACK_MODIFICATIONS = False


class DevelopmentConfig(config):
    DEBUG = True

class ProductionConfig(config):
    DEBUG = True

config_dict = {
    'development':DevelopmentConfig,
    'production':ProductionConfig
}
